DotNet::Services.RegisterAssembly Method
Syntax
Arguments
- ParentNamespaceCharacter
The name of the Alpha Anywhere namespace to assign to the .NET assembly. To use the class name registered under the .NET namespace, set ParentNamespace to an empty string.
- AssemblyDotNet::AssemblyReference
The .NET assembly.
Returns
- ResultLogical
Returns .t. or .f. whether or not the operation succeeds. The DotNet::Services CallResult property will contain additional information about the error.
Description
Connects an assembly and all of its classes to the Alpha Anywhere type system within a namespace.
Discussion
RegisterAssembly() connects an assembly and all of its classes to the Alpha Anywhere type system within a namespace.
Registering a .NET assembly allows you to use it as if it were a built-in Alpha Anywhere class or namespace. This type can be DIMmed in any script after the type is registered.
Once the assembly is registered, which is required once per execution of Alpha Anywhere, instances can be DIMmed for each of its classes in any script.
Example
Adding an assembly from the global assembly cache to the Xbasic type system.
Dim Assy as DotNet::AssemblyReference Dim Services as DotNet::Services Assy.Name = "SampleAssembly" Assy.Version = "1.0.2004.0" Assy.Culture = "neutral" Assy.PublicKeyToken = "8744b20f8da049e3" If .not. Services.RegisterAssembly("MyNameSpace", Assy) UI_Msg_Box("Error registering assembly " + \ Assy.Name, Services.CallResult.Text) End End if Dim Instance as MyNameSpace::MyClass